/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Temporal;
import type.Month;
import type.DayOfWeek;

/**
 *
 * @author edd
 */
@Entity(name="Calendar")
public class CalendarEntity extends DataObjectEntity implements Serializable {
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date publicHoliday;
    private String event;
    private int day;
    private Month month;
    private int year;
    private DayOfWeek dayOfWeek;
    
    @Override
    public String childToString() {
        return "Public Holiday" + getPublicHoliday();
    }

    public Date getPublicHoliday() {
        return publicHoliday;
    }

    public void setPublicHoliday(Date publicHoliday) {
        this.publicHoliday = publicHoliday;
    }

    public String getEvent() {
        return event;
    }

    public void setEvent(String event) {
        this.event = event;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public Month getMonth() {
        return month;
    }

    public void setMonth(int month) {

        switch (month) {
            case 0:  this.month = Month.JANUARY;       
            break;
            case 1:  this.month = Month.FEBRUARY;      
            break;
            case 2:  this.month = Month.MARCH;         
            break;
            case 3:  this.month = Month.APRIL;         
            break;
            case 4:  this.month = Month.MAY;           
            break;
            case 5:  this.month = Month.JUNE;          
            break;
            case 6:  this.month = Month.JULY;          
            break;
            case 7:  this.month = Month.AUGUST;        
            break;
            case 8:  this.month = Month.SEPTEMBER;     
            break;
            case 9: this.month = Month.OCTOBER;       
            break;
            case 10: this.month = Month.NOVEMBER;      
            break;
            case 11: this.month = Month.DECEMBER;      
            break;
        }
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public DayOfWeek getDayOfWeek() {
        return dayOfWeek;
    }

    public void setDayOfWeek(int dayOfWeek) {
        
        switch (dayOfWeek) {
            case 0:  this.dayOfWeek = DayOfWeek.Sunday;       
            break;
            case 1:  this.dayOfWeek = DayOfWeek.Monday;      
            break;
            case 2:  this.dayOfWeek = DayOfWeek.Tuesday;         
            break;
            case 3:  this.dayOfWeek = DayOfWeek.Wednesday;         
            break;
            case 4:  this.dayOfWeek = DayOfWeek.Thursday;           
            break;
            case 5:  this.dayOfWeek = DayOfWeek.Friday;          
            break;
            case 6:  this.dayOfWeek = DayOfWeek.Saturday;          
            break;
        } 
    }
}
